package cn.com.nes.site.controller;

import cn.com.nes.site.rocketmq.producer.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mq")
public class RocketMQController {
    @Autowired
    private MessageService messageService;

    @GetMapping("/sendDemoMessage")
    public String sendDemoMessage() {
        String topic = "demo-topic";
        String message = "Hello from Demo Topic!";
        messageService.sendMessageToTopic(topic, message);
        return "Message sent to demo-topic!";
    }

}
